package com.ysd.lis.controller.lab;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.lab.LabRptVsBarcode;
import com.ysd.lis.request.BarCodeTypePageParam;
import com.ysd.lis.request.DeleteRptVsBarCodeParam;
import com.ysd.lis.service.lab.LabRptVsBarcodeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author
 * @since 2023-12-16
 */
@RestController
@RequestMapping("/api/labRptVSBarcode")
public class LabRptVsBarcodeController extends BaseController {
    @Autowired
    LabRptVsBarcodeService labRptVsBarcodeService;

    @ApiOperation("根据报告单元获取分管类别")
    @GetMapping("/findBarCodeListByRptId/{id}")
    public Result findBarCodeListByRptId(@PathVariable("id") String id) {
        return labRptVsBarcodeService.findBarCodeListByRptId(id);
    }

    @ApiOperation("获取分管类别")
    @PostMapping("/findBarCodeTypeListByRpt")
    public Result findBarCodeTypeListByRpt(@RequestBody BarCodeTypePageParam barCodeTypePageParam) {
        return labRptVsBarcodeService.findBarCodeTypeListByRpt(barCodeTypePageParam);
    }

    @ApiOperation("添加对照关系")
    @PostMapping("/addRptBarCode")
    @LogDetail(requestParam ="addRptBarCode",operationType = OperationType.INSERT, module = "添加对照关系",content = "添加对照关系，报告单元ID【rptGroupId】--分管类别ID【barcodeId】", businessName = "rptGroupId")
    public Result addRptBarCode(@RequestBody LabRptVsBarcode labRptVsBarcode) {
        return labRptVsBarcodeService.addRptBarCode(labRptVsBarcode);
    }

    @ApiOperation("删除对照关系")
    @PostMapping("/deleteRptVSBarCode")
    @LogDetail(requestParam ="deleteRptVSBarCode",operationType = OperationType.DELETE, module = "删除对照关系",content = "删除对照关系，报告单元ID【rptGroupId】--分管类别ID【barcodeId】", businessName = "id")
    public Result deleteRptVSBarCode(@RequestBody DeleteRptVsBarCodeParam deleteRptVsBarCodeParam){
        return labRptVsBarcodeService.deleteRptVSBarCode(deleteRptVsBarCodeParam);
    }
}
